Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Improve embedded tweet performance #1345

Merged
merged 2 commits into from
Oct 1, 2024
Merged

Conversation

cpcramer
Copy link
Contributor

@cpcramer cpcramer commented Oct 1, 2024

What changed? Why?

Notes to reviewers

How has it been tested?

@github-actions github-actions bot added the documentation Improvements or additions to documentation label Oct 1, 2024
Comment on lines 5 to 9
// Dynamically load the Twitter script after the component mounts
const script = document.createElement('script');
script.src = 'https://platform.twitter.com/widgets.js';
script.async = true;
document.body.appendChild(script);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Main update - loading the Twitter script once instead of 3 times.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should fix loading the widget javascript

Copy link

vercel bot commented Oct 1, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
onchainkit-coverage ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 1, 2024 7:17pm
onchainkit-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 1, 2024 7:17pm
onchainkit-routes ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 1, 2024 7:17pm


useEffect(() => {
const script = document.createElement('script');
script.src = 'https://platform.twitter.com/widgets.js';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only load the widget script once...was previously loading for each tweet

@cpcramer cpcramer merged commit a8f06f1 into main Oct 1, 2024
16 checks passed
@cpcramer cpcramer deleted the paul/improve-tweet-perf branch October 14, 2024 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Development

Successfully merging this pull request may close these issues.

3 participants